package com.easyperl;

import org.eclipse.jface.dialogs.MessageDialog;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Composite;

public class MainWin {

	protected Shell shlEasyPerlV;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			MainWin window = new MainWin();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shlEasyPerlV.open();
		shlEasyPerlV.layout();
		while (!shlEasyPerlV.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shlEasyPerlV = new Shell();
		shlEasyPerlV.setSize(484, 450);
		shlEasyPerlV.setText("Easy Perl V0.1.0 ");
		shlEasyPerlV.setLayout(null);
		
		Button btnNewButton = new Button(shlEasyPerlV, SWT.NONE);
		btnNewButton.setBounds(43, 376, 134, 30);
		btnNewButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				
				VariableConfigDialog dialog = new VariableConfigDialog(shlEasyPerlV,SWT.MAX);
				
				dialog.open(); 
				
				//MessageDialog.openInformation(shlEasyPerlV, "Hello","Hello Information");
				
			}
		});
		btnNewButton.setText("Variable Config");
		
		TabFolder tabFolder = new TabFolder(shlEasyPerlV, SWT.NONE);
		tabFolder.setBounds(10, 10, 381, 311);
		
		TabItem tbtmNewItem = new TabItem(tabFolder, SWT.NONE);
		tbtmNewItem.setText("New Item");
		
		TabItem tabItem_2 = new TabItem(tabFolder, SWT.NONE);
		tabItem_2.setText("New Item");
		
		TabItem tabItem_1 = new TabItem(tabFolder, SWT.NONE);
		tabItem_1.setText("New Item");
		
		TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
		tabItem.setText("New Item");

	}
}
